﻿using T4UtilityBelt.Writers;

namespace T4UtilityBelt.UxDesigns.Bindings.Windows
{
    public class BindableRenderer : IBindableRenderer
    {
        private readonly BindingRenderer _renderer = new BindingRenderer();

        public void Render(CodeWriter writer, string property, Bindable binding)
        {
            if (binding.HasValue)
            {
                writer.WriteAttribute(property, binding.ToString());
            }
            else
            {
                _renderer.Render(writer, property, binding.Binding);
            }
        }
    }
}